import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 路由组件  全部使用路由懒加载
import ErrorRoute from '@/views/Errorpage/route'
import LoginRoute from '@/views/Logins/route'
import AppRoute from '@/views/App/route'
import MyRoute from '@/views/My/route'
import FilmRoute from '@/views/film/route'
import GoodRoute from '@/views/good/route' 

// 2. 路由选项参数 
const routes = [
    {
        path:"/",
        redirect:{name:"guide"}
    },
    {
        path:"/guide",
        name:"guide",
        component:()=>import('@/views/Guide/Guide.vue')
    },
    {
        path:"/search",
        name:"search",
        component:()=>import('@/views/Search/Search.vue')
    },
    {
        path:"/city",
        name:'city',
        component:()=>import("@/views/City/City.vue")
    },
    ...ErrorRoute,
    ...LoginRoute,
    ...AppRoute,
    ...MyRoute,
    ...FilmRoute,
    ...GoodRoute,
    {
        path:"*",
        redirect:{
            name:"notfound"
        }
    }
]

// 3. 创建路由对象
const router = new VueRouter({
    mode:'hash',
    base:"",
    routes 
})

// 4. 暴露
export default router 